const db = require('../config/db')

const searchFriends = (req, res) => {
    let name = req.body.add
    db.query('SELECT * FROM friends', async(err, er) => {
        let data = []
        name == '' || name == null ? data = [] : data = er.filter(item => item.friends_name.indexOf(name) != -1 || item.friends_email.indexOf(name) != -1)
        res.send({ code: 200, msg: '查询成功', data })
    })

}
module.exports = { searchFriends }